import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
// import zhlocale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

import myPlugin from '@/components'
Vue.use(myPlugin)

// 全局引入全部过滤器函数!
import * as Myfilter from '@/filters'
for (const key in Myfilter) {
  Vue.filter(key, Myfilter[key])
}

import i18n from '@/i18n'
// set ElementUI lang to EN
// Vue.use(ElementUI, { zhlocale })
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

Vue.config.productionTip = false

import Mixin from '@/mixin'
Vue.mixin(Mixin)
// 创建vue自定义指令
// 1.检测图片链接是否有误!做一个error事件
import fiximg from '@/directive/fiximg'
Vue.directive('fiximg', fiximg)

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
